[<tag id="resourcepath" type="meta" value="/DesktopModules/NBright/NBrightEspace/App_LocalResources/" />]
[Template:config.txt]
[Template:scriptincludes.html]
<script>

    $(function () {

        // Progressbar
        $("#progressbar").progressbar({
            value: 0
        });

        $(".rblstatus").buttonset();

        $.datepicker.setDefaults($.datepicker.regional[['en-GB']]);

        $('input[[name$="txtStartDate"]]').datepicker({ onSelect: showDays });
        $('input[[name$="txtEstEndDate"]]').datepicker({ onSelect: showDays });
        $('input[[name$="txtEndDate"]]').datepicker({ onSelect: showDays });
        $('input[[name$="txtTimeInpDate"]]').datepicker({ onSelect: showDays });
        $('input[[name$="txtCostsInpDate"]]').datepicker({ onSelect: showDays });
    });
	
	function showDays() { 
			var start = $('input[[name$="txtStartDate"]]').datepicker('getDate'); 
			var end   = $('input[[name$="txtEndDate"]]').datepicker('getDate'); 
			
			if(!start || !end) 
				return; 
			var days = (end - start)/1000/60/60/24; 
			var formatdays = days.toFixed(2); 
			$('input[[name$="hidDuration"]]').val(formatdays);  
			$('#lblDuration').text(formatdays + ' days');			
	} 
	
	function updateProgress(){
		var cmdgetprogress = '/desktopmodules/Nbright/NBrightEspace/XmlConnector.ashx?cmd=getprogress&itemid=[<tag type="valueof" xpath="genxml/hidden/itemid" />]';
		$.ajax({
		    url: cmdgetprogress
		}).done(function (data) {
		    $('input[[name$="txtOverallProgress"]]').val(data);
		    $('#progressbar').progressbar('value', parseInt(data));
		});
	}

	function updateProjectTime() {
	    var cmdgetprogress = '/desktopmodules/Nbright/NBrightEspace/XmlConnector.ashx?cmd=getprojecttime&itemid=[<tag type="valueof" xpath="genxml/hidden/itemid" />]';
	    $.ajax({
	        url: cmdgetprogress
	    }).done(function (data) {
	        $('input[[name$="txtOverallProgress"]]').val(data);
	        $('#progressbar').progressbar('value', parseInt(data));
	    });
	}

    function displayList(data, ajaxbutton, sellistdiv) {
        $(sellistdiv).html(data);
        $(ajaxbutton).click(function () {
            var cmd = $(this).attr("cmd");
            $.get(cmd, function (data) {
				updateProgress();
                displayList(data, ajaxbutton, sellistdiv);
            });
        });
    };
	
	function initlist(sellistdiv, ajaxbutton, cmdget) {
        $.ajaxSetup({ cache: false });
        $.get(cmdget, function (data) {
            displayList(data, ajaxbutton, sellistdiv);			
        });

    };



    $(document).ready(function () {

        $("#tabs").tabs({
            cookie: {}
        });

        $('#progressbar').progressbar('value', parseInt($('input[[name$="txtOverallProgress"]]').val()));
        showDays();

        var cmdget = '/desktopmodules/Nbright/NBrightEspace/XmlConnector.ashx?cmd=getdata&templ=actions.xsl&ctltype=ACTIONS&cat=0&itemid=[<tag type="valueof" xpath="genxml/hidden/itemid" />]';
        initlist('.NBright_ActionList0', '.ajaxbutton0', cmdget);
        cmdget = '/desktopmodules/Nbright/NBrightEspace/XmlConnector.ashx?cmd=getdata&templ=actions.xsl&ctltype=ACTIONS&cat=1&itemid=[<tag type="valueof" xpath="genxml/hidden/itemid" />]';
        initlist('.NBright_ActionList1', '.ajaxbutton1', cmdget);
        cmdget = '/desktopmodules/Nbright/NBrightEspace/XmlConnector.ashx?cmd=getdata&templ=actions.xsl&ctltype=ACTIONS&cat=2&itemid=[<tag type="valueof" xpath="genxml/hidden/itemid" />]';
        initlist('.NBright_ActionList2', '.ajaxbutton2', cmdget);
        cmdget = '/desktopmodules/Nbright/NBrightEspace/XmlConnector.ashx?cmd=getdata&templ=actions.xsl&ctltype=ACTIONS&cat=3&itemid=[<tag type="valueof" xpath="genxml/hidden/itemid" />]';
        initlist('.NBright_ActionList3', '.ajaxbutton3', cmdget);
        cmdget = '/desktopmodules/Nbright/NBrightEspace/XmlConnector.ashx?cmd=getdata&templ=actions.xsl&ctltype=ACTIONS&cat=4&itemid=[<tag type="valueof" xpath="genxml/hidden/itemid" />]';
        initlist('.NBright_ActionList4', '.ajaxbutton4', cmdget);
        cmdget = '/desktopmodules/Nbright/NBrightEspace/XmlConnector.ashx?cmd=getdata&templ=actions.xsl&ctltype=ACTIONS&cat=5&itemid=[<tag type="valueof" xpath="genxml/hidden/itemid" />]';
        initlist('.NBright_ActionList5', '.ajaxbutton5', cmdget);
        cmdget = '/desktopmodules/Nbright/NBrightEspace/XmlConnector.ashx?cmd=getdata&templ=actions.xsl&ctltype=ACTIONS&cat=6&itemid=[<tag type="valueof" xpath="genxml/hidden/itemid" />]';
        initlist('.NBright_ActionList6', '.ajaxbutton6', cmdget);
        cmdget = '/desktopmodules/Nbright/NBrightEspace/XmlConnector.ashx?cmd=getdata&templ=actions.xsl&ctltype=ACTIONS&cat=7&itemid=[<tag type="valueof" xpath="genxml/hidden/itemid" />]';
        initlist('.NBright_ActionList7', '.ajaxbutton7', cmdget);
        cmdget = '/desktopmodules/Nbright/NBrightEspace/XmlConnector.ashx?cmd=getdata&templ=actions.xsl&ctltype=ACTIONS&cat=8&itemid=[<tag type="valueof" xpath="genxml/hidden/itemid" />]';
        initlist('.NBright_ActionList8', '.ajaxbutton8', cmdget);
        cmdget = '/desktopmodules/Nbright/NBrightEspace/XmlConnector.ashx?cmd=getdata&templ=actions.xsl&ctltype=ACTIONS&cat=9&itemid=[<tag type="valueof" xpath="genxml/hidden/itemid" />]';
        initlist('.NBright_ActionList9', '.ajaxbutton9', cmdget);

	
		//Tasks
		var myParams = {cmd: "getdata",templ: "taskslist.xsl",ctltype: "TASKS",filter: " and ([xmlData].value('(genxml/hidden/projectid)[[1]]', 'nvarchar(10)') = '[<tag type="valueof" xpath="genxml/hidden/itemid" />]')"};
		cmdget = '/desktopmodules/Nbright/NBrightEspace/XmlConnector.ashx?' + jQuery.param(myParams);
		$.fn.initlist('.tasks', '', cmdget);


    }); 
	
</script>	
<style>

.NBright_ActionHeader {
  clear: both;
}

.NBright_ActionGroup {
  clear: both;
}

.NBright_ActionClear {
  clear: both;
}

.NBright_ActionLeftCol {
  float: left;
  padding: 3px 10px 3px 3px;
  width: 350px;
}

.NBright_ActionLeft {
  float: left;
  padding: 3px 3px 3px 3px;
}
.NBright_ToolTip {
  padding: 3px 3px 3px 3px;
    border: black;
}

		.tooltip {
			border-bottom: 1px dotted #000000; color: #000000; outline: none;
			cursor: help; text-decoration: none;
			position: relative;
		}
		.tooltip span {
			margin-left: -999em;
			position: absolute;
		}
		.tooltip:hover span {
			border-radius: 5px 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; 
			box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.1); -webkit-box-shadow: 5px 5px rgba(0, 0, 0, 0.1); -moz-box-shadow: 5px 5px rgba(0, 0, 0, 0.1);
			font-family: Calibri, Tahoma, Geneva, sans-serif;
			position: absolute; left: 1em; top: 2em; z-index: 99;
			margin-left: 0; width: 350px;
		}
		.tooltip:hover img {
			border: 0; margin: -10px 0 0 -55px;
			float: left; position: absolute;
		}
		.tooltip:hover em {
			font-family: Candara, Tahoma, Geneva, sans-serif; font-size: 1.2em; font-weight: bold;
			display: block; padding: 0.2em 0 0.6em 0;
		}
		.classic { padding: 0.8em 1em; }
		.classic {background: #ffffff; border: 1px solid #222222; }
	</style>

<div class="nwb-button-group">
[<tag id="cmdUpdate1" type="linkbutton" text="Save" tooltip="Update" commandname="Update" cssclass="nwb-button primary icon approve" commandargument="ItemID"/>]&nbsp;
[<tag id="cmdUpdate2" type="linkbutton" text="Save and Exit" tooltip="Update and Exit" commandname="Updateexit" cssclass="nwb-button primary icon approve" commandargument="ItemID"/>]&nbsp;
[<tag id="cmdDelete1" type="linkbutton" text="Delete" tooltip="Delete" cssclass="nwb-button danger icon remove" commandname="Delete" commandargument="ItemID" confirm="Delete Item?" />]&nbsp;
[<tag id="cmdCancel1" type="linkbutton" text="Cancel" tooltip="Cancel" commandname="Cancel" cssclass="nwb-button danger" commandargument="ItemID" causesvalidation="False"/>]&nbsp;
</div>
<div>
[<tag id="hidAllocatedCosts" type="hidden" value="0" />]
[<tag id="hidAllocatedHours" type="hidden" value="0" />]
[<tag id="hidDuration" type="hidden" value="0" />]
[<tag id="TotalHours" type="hidden" value="0" />]
[<tag id="HourlyRate" type="hidden" value="0" />]
[<tag id="ProjectRef" type="hidden" value="" />]
[<tag id="CreatedBy" type="hidden" value="" />]
[<tag id="ItemID" type="hidden" value="databind:ItemID" />]
[<tag id="LockedBy" type="hidden" value="" />]
[<tag id="htmlDisplayLockedBy" type="hidden" value="" />]
[<tag type="valueof" xpath="genxml/hidden/htmldisplaylockedby" />]

<div style="display: none;">
[<tag id="txtOverallProgress" type="textbox" text="0" />]
</div>
<table class="normal" border="0px" cellpadding="1px" cellspacing = "1px">
<tr>
<td>

<table class="normal" border="0px" cellpadding="1px" cellspacing = "1px">
<tr>
<td align="right">Project Ref : </td>
<td>[<tag type="valueof" xpath="genxml/hidden/projectref" />]</td>
</tr>
<tr>
<td align="right">Friendly Name : </td>
<td>[<tag id="txtProjectName" type="textbox" width="250" maxlength="200" />]</td>
</tr>
<tr>
<td align="right">Manager : </td>
<td>[<tag id="txtManager" type="textbox" width="250" maxlength="200" />]</td>
</tr>
<tr>
<td align="right">Test Url : </td>
<td>[<tag id="txtTestUrl" type="textbox" width="250" maxlength="200" />]</td>
</tr>
<tr>
<td align="right">Live Url : </td>
<td>[<tag id="txtLiveUrl" type="textbox" width="250" maxlength="200" />]</td>
</tr>
<tr>
<td align="right"></td>
<td>[<tag id="chkDepositNotPaid" type="checkbox" text="Deposit Not Paid" />]</td>
</tr>
<tr>
<td align="right"></td>
<td>[<tag id="chkClosed" type="checkbox" text="Closed" />]</td>
</tr>
</table>

</td>
<td>

[Template:ClientBasicSelect.html]

</td>
</tr>
</table>
			<br/>
			<table>
			<tr>
			<td align="right" width="100px">Total Hours : <td><td>[<tag id="lblTotalHours" type="label"  xpath="genxml/hidden/totalhours" />]</td>
	<td align="right" width="100px"><td><td></td><td style="color:crimson;"><div class="hourlyrate"></div></td>
			</tr>
			</table>

			<table width="800px">
			<tr>
			<td align="right" width="100px">Overall : <td><td width="700px"><div id="progressbar"></div></td>
			</tr>
			</table>
			<br/>
			[<tag id="rblStatus" type="radiobuttonlist" cssclass="rblstatus" data="Urgent;Waiting for client;Proceeding;On Hold;Completed" datavalue="1;4;6;18;20" repeatcolumns="5" repeatdirection="1"  />]
			<br/>
		<div id="tabs">
			<ul>
				<li><a href="#tabs-1">General</a></li>
				<li><a href="#tabs-2">Actions</a></li>
				<li><a href="#tabs-4">Time</a></li>
				<li><a href="#tabs-6">Costs</a></li>
				<li><a href="#tabs-5">Tasks</a></li>
				<li><a href="#tabs-3">History</a></li>
			</ul>
			<div id="tabs-1">
			Project Description<br />[<tag id="txtTaskDesc" type="textbox" height="100" width="800" textmode="MultiLine" />]
			<br/>
			<table>
			<tr>
			<td align="right">Comments to Client : </td>
			<td>[<tag id="txtComments" type="textbox"  width="500"  />]</td>
			</tr>
			<tr>
			<td align="right">Internal Notes : </td>
			<td>[<tag id="txtNotes" type="textbox" width="500" />]</td>
			</tr>
			</table>				
			<br/>			
			<table>
			<tr>
			<td align="right">Start Date : </td><td>[<tag id="txtStartDate" datatype="date" type="textbox" width="100" />]</td>
			<td align="right">Est. End Date : </td><td>[<tag id="txtEstEndDate" datatype="date" type="textbox" width="100" />]</td>
			<td align="right">Act. End Date : </td><td>[<tag id="txtEndDate" datatype="date" type="textbox" width="100" />]</td>
			<td align="right">Duration : </td><td><div id="lblDuration"></div></td>
			<td align="right"></td><td></td>
			</tr>
			<tr>
			<td align="right">Invoice Amt : </td><td>[<tag id="txtInvAmt" datatype="double" type="textbox" width="100" />]</td>
			<td align="right">Hourly Rate : </td><td>[<tag id="txtHourlyRate" datatype="double" type="textbox" width="100" />]</td>
			<td align="right">Allocated Hours : </td><td>[<tag type="valueof"  xpath="genxml/hidden/hidallocatedhours"   />]</td>
			<td align="right">Current Hourly Rate : </td><td>[<tag type="valueof" xpath="genxml/hidden/hourlyrate"  datatype="double" />]</td>
			<td align="right">Allocated Costs : </td><td>[<tag type="valueof"  xpath="genxml/hidden/hidallocatedcosts" datatype="double" />]</td>
			</tr>
			</table>
			</div>
			<div id="tabs-2">
            <table>
<tr>
<td>Project Type : </td>
<td>[<tag id="chkActionTypes" type="checkboxlist" repeatcolumns="10" repeatdirection="0"  datavalue="{$ActionTypeValues}" data="{$ActionTypeNames}" />]</td>
</tr>
</table>
			<div class="nwb-button-container">
			[<tag id="cmdCreateActions" type="linkbutton" text="Create Actions" tooltip="Create Actions" commandname="CreateActions" cssclass="nwb-button primary icon approve" commandargument="ItemID"/>]
			</div>
			<div class="NBright_ActionList0">
			</div>
			<div class="NBright_ActionList1">
			</div>
			<div class="NBright_ActionList2">
			</div>
			<div class="NBright_ActionList3">
			</div>
			<div class="NBright_ActionList4">
			</div>
			<div class="NBright_ActionList5"> 
			</div>
			<div class="NBright_ActionList6">
			</div>
			<div class="NBright_ActionList7">
			</div>
			<div class="NBright_ActionList8">
			</div>
			<div class="NBright_ActionList9">
			</div>
			</div>
			<div id="tabs-4">
			    [Template:TimeAuditCtrl.html]
			</div>
			<div id="tabs-6">
			    [Template:CostsAuditCtrl.html]
			</div>
			<div id="tabs-5">
				<div class="tasks">
				</div>
			</div>
			<div id="tabs-3">
			[Template:HistoryAuditCtrl.html]	
			</div>
		</div>


    <font size="1px">Last Modified : [<tag type="valueof" databind="ModifiedDate" />]</font>
</div>

